<%--
    Sample page template
    ====================

This is the guide to create a sample page template for a page. This page should be located under the current theme
folder. Eg. if the current theme is default, page template like this should lies under

  + /wikiThemes/default/.....

If it lies in eg.

  + /wikiThemes/default/page/myPageTemplate.jsp

then it should be given a path of '/page/myPageTemplate.jsp' when configured through the web based interface.

*  You want to include the following at the top of the page, cause that'll gives you the tags you'll need.
        <%@include file="/WEB-INF/pages/commons/commons.jsp" %>

*   The following parameters are avaiable from actionBean, eg. their properties could be retrieved through
    jstl expression eg. ${actionBean.page.id} etc.
        - page (foo.bar.wiki.domain.Page)

*   You must cater for the following :-
        - viewing of this page (after rendering the page content through a RenderEngine)

*   You might want to cater for the followings :-
        - editing of this page's wiki syntax

*   To get the page content rendered by the RenderEngine, use :-
        <stripes:useActionBean alwaysExecuteEvent="true"
                                beanclass="foo.bar.wiki.web.action.page.PageActionBean"
                                event="preparePageContents"
                                executeResolution="false"
                                validate="false"
                                var="_pageContent"/>
    The rendered content could be obtained through :-
            <c:out value="${_pageContent.renderedContent}" escapeXml="false"/>

    The comments through :-
            <c:forEach items="${_pageContent.page.comments}" var="comment" varStatus="stat">
                <c:out value="${comment.renderedContent}" escapeXml="false"/>
            </c:forEach>
    To add comment to this page use, the captcha is necessary, else validation would failed, and no comments
    would be added :-
            <stripes:form beanclass="foo.bar.wiki.web.action.comment.AddCommentActionBean" method="POST">
                <stripes:errors/>
                <stripes:hidden name="page" value="${_pageContent.page.id}"/>
                <stripes:textarea name="comment.content" style="width:100%; height:100%;" rows="10" />
                <img src="<c:url value='/kaptcha.jpg'/>"/> <stripes:text name="kaptcha" />
                <stripes:submit name="save">Save</stripes:submit>
            </stripes:form>

*   If you want to used the existing action to :-
        - edit this page wiki syntax :-
            <stripes:url beanclass="foo.bar.wiki.web.action.page.EditPageActionBean" event="view">
                <stripes:param name="currentPage" value="${actionBean.page.id}"/>
                Edit this page (using wiki syntax)
            </stripes:url>

*   If you have many pages that shared the same layout, you might be interested in Stripes layout tags.
    The definition looks like :-
         <stripes:layout-definition>
            <stripes:component name="compA"/>
            ...
         </stripes:layout-definition>

    The rendering looks like :-
         <stripes:layout-render name="<full path to the layout definition>">
            ...
            <stripes:component name="compA">
                ...
            </stripes:component/>
            ...
         </stripes:layout-render>
--%>

<!--
   A simple custom page template
-->
<%@include file="/WEB-INF/pages/commons/commons.jsp" %>

<html>
<head>
    <title>A simple custom page template</title>
</head>
<body>
    To edit this page click
    <stripes:url beanclass="foo.bar.wiki.web.action.page.EditPageActionBean" event="view">
                <stripes:param name="currentPage" value="${actionBean.page.id}"/>
                here
    </stripes:url>.

    <hr/>

    This is how this page content looks like :- <p/>

    <stripes:useActionBean alwaysExecuteEvent="true"
                                beanclass="foo.bar.wiki.web.action.page.PageActionBean"
                                event="preparePageContents"
                                executeResolution="false"
                                validate="false"
                                var="_pageContent"/>
    <c:out value="${_pageContent.renderedContent}" escapeXml="false"/>

    <hr/>

    The comments for this page are as follows :- <p/>

    <ul>
    <c:forEach items="${_pageContent.page.comments}" var="comment" varStatus="stat">
        <li><c:out value="${comment.renderedContent}" escapeXml="false"/></li>
    </c:forEach>
    </ul>

    <hr/>

    If you want to add a content, submit this form :-

    <stripes:form beanclass="foo.bar.wiki.web.action.comment.AddCommentActionBean" method="POST">
        <stripes:errors/>
        <stripes:hidden name="page" value="${_pageContent.page.id}"/>
        <stripes:textarea name="comment.content" style="width:100%; height:100%;" rows="10" />
        <img src="<c:url value='/kaptcha.jpg'/>"/> <stripes:text name="kaptcha" />
        <stripes:submit name="save">Save</stripes:submit>
    </stripes:form>

</body>
</html>


